import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_lifecycle_base/widget/status_bar_wrap.dart';
import 'package:wallet_home/page/theme/colors.dart';
import 'package:wallet_home/tools/theme_utils.dart';

//import 'package:flutter_demo/global/tools/device.dart';
//import 'package:flutter_demo/widget/search_bar.dart';

class CustomAppBar extends StatefulWidget implements PreferredSizeWidget {
  BuildContext context;
  Widget child;

  CustomAppBar(this.context, {@required this.child});

  @override
  _CustomAppBarState createState() => _CustomAppBarState();

  @override
  Size get preferredSize =>
      Size.fromHeight(MediaQuery.of(context).padding.top + 44);
}

class _CustomAppBarState extends State<CustomAppBar> {
  @override
  Widget build(BuildContext context) {
    return StatusBarWrap(
      child: Container(
//        [Color(0xFF0445d1), Color(0xFF007ff3)]
          color: ThemeUtils.getThemeColor(
              context: context,
              brightnessColor: Colours.dark_app_main,
              darkColor: Colors.grey[800]),
          height: widget.preferredSize.height,
          child: Container(
            margin: EdgeInsets.only(top: 0),
            child: widget.child,
          )),
    );
  }
}
